package com.yudylaw.algorithm;

public class YueSeFuHuan {

	public static void main(String[] args) {
		System.out.println("King:"+find(10, 2));
	}
	
	public static int find(int n, int m)
	{
		int r = 0;//f[1]=0
		for (int i = 2; i <= n; i++) {//f[2],f[3],f[n-1],f[n]
			r = (r + m) % i;//i++ ,f(0)->f(1)->...->f(n-1)->f(n)
		}
		return r + 1;//+1,reality number
	}

}
